package com.shenzw.mybatisdemo.config.pojo;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Builder;
import lombok.Getter;
import lombok.ToString;

/**
 * 成功响应体
 *
 * @author shenzw
 * @date 2023/10/29
 */
@Getter
@Builder
@ToString
public class SuccessInfo<T> extends ResultInfo {

    /**
     * 成功默认响应码
     */
    protected static final Integer DEFAULT_CODE = 200;

    /**
     * 成功默认响应消息
     */
    protected static final String DEFAULT_MESSAGE = "操作成功";

    /**
     * 响应消息体
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    protected T data;

    public SuccessInfo(T data) {
        super(true, DEFAULT_CODE, DEFAULT_MESSAGE);
        this.data = data;
    }
}
